package com.wangyb.wework.entity.contact;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

import java.io.Serializable;
import java.util.Date;

/**
 * 客户-标签关联对象 ww_contact_tag_pivot
 *
 * @Author: wangyb
 * @Date: 2021/6/30 5:50 下午
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("ww_contact_tag_pivot")
public class WwContactTagPivot implements Serializable {

	private static final long serialVersionUID=1L;


	/** $column.columnComment */
	@TableId(value = "id")
	private Long id;

	/** 客户表ID（ww_contact.id） */
	private Long contactId;

	/** 员工表id（ww_employee.id） */
	private Long employeeId;

	/** 客户标签表ID（ww_tag.id） */
	private Long tagId;
	/** 微信企业标签id 仅企业设置（type为1）的标签*/
	private String wxTagId;
	/** 标签分组名称 */
	private String groupName;
	/** 标签名称 */
	private String tagName;
	private Long corpId;

	/** 该成员添加此外部联系人所打标签类型, 1-企业设置, 2-用户自定义 */
	private Integer type;

	/** $column.columnComment */
	@TableField(fill = FieldFill.INSERT)
	private Date createTime;

	/** $column.columnComment */
	@TableField(fill = FieldFill.INSERT_UPDATE)
	private Date updateTime;

	@TableField(exist = false)
	private String wxUserId;


	@Override
	public boolean equals(Object o) {
		if (this == o) return true;

		if (o == null || getClass() != o.getClass()) return false;

		WwContactTagPivot that = (WwContactTagPivot) o;

		return new EqualsBuilder().append(contactId, that.contactId).append(employeeId, that.employeeId).append(tagId, that.tagId).append(corpId, that.corpId).append(type, that.type).isEquals();
	}

	@Override
	public int hashCode() {
		return new HashCodeBuilder(17, 37).append(contactId).append(employeeId).append(tagId).append(corpId).append(type).toHashCode();
	}
}
